<?php
/**
 * Created by PhpStorm.
 * User: Sunmer
 * Date: 2019/6/2 0002
 * Time: 0:42
 * Email:Sunmer@foxmail.com
 */
namespace app\admin\controller;
use app\admin\Controller;

class Cash extends Controller{
    /**
     * 列表
     * @return string
     * @throws \think\Exception
     */
    public function index()
    {
        $model = $this->getModel();

        // 列表过滤器，生成查询Map对象
        $map = $this->search($model, [$this->fieldIsDelete => $this::$isdelete]);

        // 特殊过滤器，后缀是方法名的
        $actionFilter = 'filter' . $this->request->action();
        if (method_exists($this, $actionFilter)) {
            $this->$actionFilter($map);
        }
        // 自定义过滤器
        if (method_exists($this, 'filter')) {
            $this->filter($map);
        }
        $this->datalist($model, $map);

        return $this->view->fetch();
    }

    /**
     * 搜索
     * @param $map
     */
    protected function filter(&$map)
    {

        if ($this->request->param('cash_mobile')) {
            $map['cash_mobile'] = ["like", "%" . $this->request->param('cash_mobile') . "%"];
        }
    }
}